<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>cgbmv.f</title>
 <meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!-- 
body { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default   { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default a { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.string   { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.string a { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.comment   { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.comment a { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
 --></style>

 </head>
  <body>

<pre>
      SUBROUTINE <a name="CGBMV.1"></a><a href="cgbmv.f.html#CGBMV.1">CGBMV</a>(TRANS,M,N,KL,KU,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
<span class="comment">*</span><span class="comment">     .. Scalar Arguments ..
</span>      COMPLEX ALPHA,BETA
      INTEGER INCX,INCY,KL,KU,LDA,M,N
      CHARACTER TRANS
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      COMPLEX A(LDA,*),X(*),Y(*)
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Purpose
</span><span class="comment">*</span><span class="comment">  =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  <a name="CGBMV.14"></a><a href="cgbmv.f.html#CGBMV.1">CGBMV</a>  performs one of the matrix-vector operations
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     y := alpha*A*x + beta*y,   or   y := alpha*A'*x + beta*y,   or
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     y := alpha*conjg( A' )*x + beta*y,
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  where alpha and beta are scalars, x and y are vectors and A is an
</span><span class="comment">*</span><span class="comment">  m by n band matrix, with kl sub-diagonals and ku super-diagonals.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Arguments
</span><span class="comment">*</span><span class="comment">  ==========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  TRANS  - CHARACTER*1.
</span><span class="comment">*</span><span class="comment">           On entry, TRANS specifies the operation to be performed as
</span><span class="comment">*</span><span class="comment">           follows:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              TRANS = 'N' or 'n'   y := alpha*A*x + beta*y.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              TRANS = 'T' or 't'   y := alpha*A'*x + beta*y.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              TRANS = 'C' or 'c'   y := alpha*conjg( A' )*x + beta*y.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  M      - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, M specifies the number of rows of the matrix A.
</span><span class="comment">*</span><span class="comment">           M must be at least zero.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N      - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, N specifies the number of columns of the matrix A.
</span><span class="comment">*</span><span class="comment">           N must be at least zero.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  KL     - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, KL specifies the number of sub-diagonals of the
</span><span class="comment">*</span><span class="comment">           matrix A. KL must satisfy  0 .le. KL.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  KU     - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, KU specifies the number of super-diagonals of the
</span><span class="comment">*</span><span class="comment">           matrix A. KU must satisfy  0 .le. KU.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  ALPHA  - COMPLEX         .
</span><span class="comment">*</span><span class="comment">           On entry, ALPHA specifies the scalar alpha.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  A      - COMPLEX          array of DIMENSION ( LDA, n ).
</span><span class="comment">*</span><span class="comment">           Before entry, the leading ( kl + ku + 1 ) by n part of the
</span><span class="comment">*</span><span class="comment">           array A must contain the matrix of coefficients, supplied
</span><span class="comment">*</span><span class="comment">           column by column, with the leading diagonal of the matrix in
</span><span class="comment">*</span><span class="comment">           row ( ku + 1 ) of the array, the first super-diagonal
</span><span class="comment">*</span><span class="comment">           starting at position 2 in row ku, the first sub-diagonal
</span><span class="comment">*</span><span class="comment">           starting at position 1 in row ( ku + 2 ), and so on.
</span><span class="comment">*</span><span class="comment">           Elements in the array A that do not correspond to elements
</span><span class="comment">*</span><span class="comment">           in the band matrix (such as the top left ku by ku triangle)
</span><span class="comment">*</span><span class="comment">           are not referenced.
</span><span class="comment">*</span><span class="comment">           The following program segment will transfer a band matrix
</span><span class="comment">*</span><span class="comment">           from conventional full matrix storage to band storage:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 DO 20, J = 1, N
</span><span class="comment">*</span><span class="comment">                    K = KU + 1 - J
</span><span class="comment">*</span><span class="comment">                    DO 10, I = MAX( 1, J - KU ), MIN( M, J + KL )
</span><span class="comment">*</span><span class="comment">                       A( K + I, J ) = matrix( I, J )
</span><span class="comment">*</span><span class="comment">              10    CONTINUE
</span><span class="comment">*</span><span class="comment">              20 CONTINUE
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDA    - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, LDA specifies the first dimension of A as declared
</span><span class="comment">*</span><span class="comment">           in the calling (sub) program. LDA must be at least
</span><span class="comment">*</span><span class="comment">           ( kl + ku + 1 ).
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  X      - COMPLEX          array of DIMENSION at least
</span><span class="comment">*</span><span class="comment">           ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
</span><span class="comment">*</span><span class="comment">           and at least
</span><span class="comment">*</span><span class="comment">           ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
</span><span class="comment">*</span><span class="comment">           Before entry, the incremented array X must contain the
</span><span class="comment">*</span><span class="comment">           vector x.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INCX   - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, INCX specifies the increment for the elements of
</span><span class="comment">*</span><span class="comment">           X. INCX must not be zero.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  BETA   - COMPLEX         .
</span><span class="comment">*</span><span class="comment">           On entry, BETA specifies the scalar beta. When BETA is
</span><span class="comment">*</span><span class="comment">           supplied as zero then Y need not be set on input.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Y      - COMPLEX          array of DIMENSION at least
</span><span class="comment">*</span><span class="comment">           ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
</span><span class="comment">*</span><span class="comment">           and at least
</span><span class="comment">*</span><span class="comment">           ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
</span><span class="comment">*</span><span class="comment">           Before entry, the incremented array Y must contain the
</span><span class="comment">*</span><span class="comment">           vector y. On exit, Y is overwritten by the updated vector y.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INCY   - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, INCY specifies the increment for the elements of
</span><span class="comment">*</span><span class="comment">           Y. INCY must not be zero.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Level 2 Blas routine.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- Written on 22-October-1986.
</span><span class="comment">*</span><span class="comment">     Jack Dongarra, Argonne National Lab.
</span><span class="comment">*</span><span class="comment">     Jeremy Du Croz, Nag Central Office.
</span><span class="comment">*</span><span class="comment">     Sven Hammarling, Nag Central Office.
</span><span class="comment">*</span><span class="comment">     Richard Hanson, Sandia National Labs.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Parameters ..
</span>      COMPLEX ONE
      PARAMETER (ONE= (1.0E+0,0.0E+0))
      COMPLEX ZERO
      PARAMETER (ZERO= (0.0E+0,0.0E+0))
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      COMPLEX TEMP
      INTEGER I,INFO,IX,IY,J,JX,JY,K,KUP1,KX,KY,LENX,LENY
      LOGICAL NOCONJ
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      LOGICAL <a name="LSAME.143"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      EXTERNAL <a name="LSAME.144"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL <a name="XERBLA.147"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC CONJG,MAX,MIN
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
      IF (.NOT.<a name="LSAME.156"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(TRANS,<span class="string">'N'</span>) .AND. .NOT.<a name="LSAME.156"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(TRANS,<span class="string">'T'</span>) .AND.
     +    .NOT.<a name="LSAME.157"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(TRANS,<span class="string">'C'</span>)) THEN
          INFO = 1
      ELSE IF (M.LT.0) THEN
          INFO = 2
      ELSE IF (N.LT.0) THEN
          INFO = 3
      ELSE IF (KL.LT.0) THEN
          INFO = 4
      ELSE IF (KU.LT.0) THEN
          INFO = 5
      ELSE IF (LDA.LT. (KL+KU+1)) THEN
          INFO = 8
      ELSE IF (INCX.EQ.0) THEN
          INFO = 10
      ELSE IF (INCY.EQ.0) THEN
          INFO = 13
      END IF
      IF (INFO.NE.0) THEN
          CALL <a name="XERBLA.175"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>(<span class="string">'<a name="CGBMV.175"></a><a href="cgbmv.f.html#CGBMV.1">CGBMV</a> '</span>,INFO)
          RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Quick return if possible.
</span><span class="comment">*</span><span class="comment">
</span>      IF ((M.EQ.0) .OR. (N.EQ.0) .OR.
     +    ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
<span class="comment">*</span><span class="comment">
</span>      NOCONJ = <a name="LSAME.184"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(TRANS,<span class="string">'T'</span>)
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Set  LENX  and  LENY, the lengths of the vectors x and y, and set
</span><span class="comment">*</span><span class="comment">     up the start points in  X  and  Y.
</span><span class="comment">*</span><span class="comment">
</span>      IF (<a name="LSAME.189"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(TRANS,<span class="string">'N'</span>)) THEN
          LENX = N
          LENY = M
      ELSE
          LENX = M
          LENY = N
      END IF
      IF (INCX.GT.0) THEN
          KX = 1
      ELSE
          KX = 1 - (LENX-1)*INCX
      END IF
      IF (INCY.GT.0) THEN
          KY = 1
      ELSE
          KY = 1 - (LENY-1)*INCY
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Start the operations. In this version the elements of A are
</span><span class="comment">*</span><span class="comment">     accessed sequentially with one pass through the band part of A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     First form  y := beta*y.
</span><span class="comment">*</span><span class="comment">
</span>      IF (BETA.NE.ONE) THEN
          IF (INCY.EQ.1) THEN
              IF (BETA.EQ.ZERO) THEN
                  DO 10 I = 1,LENY
                      Y(I) = ZERO
   10             CONTINUE
              ELSE
                  DO 20 I = 1,LENY
                      Y(I) = BETA*Y(I)
   20             CONTINUE
              END IF
          ELSE
              IY = KY
              IF (BETA.EQ.ZERO) THEN
                  DO 30 I = 1,LENY
                      Y(IY) = ZERO
                      IY = IY + INCY
   30             CONTINUE
              ELSE
                  DO 40 I = 1,LENY
                      Y(IY) = BETA*Y(IY)
                      IY = IY + INCY
   40             CONTINUE
              END IF
          END IF
      END IF
      IF (ALPHA.EQ.ZERO) RETURN
      KUP1 = KU + 1
      IF (<a name="LSAME.240"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(TRANS,<span class="string">'N'</span>)) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Form  y := alpha*A*x + y.
</span><span class="comment">*</span><span class="comment">
</span>          JX = KX
          IF (INCY.EQ.1) THEN
              DO 60 J = 1,N
                  IF (X(JX).NE.ZERO) THEN
                      TEMP = ALPHA*X(JX)
                      K = KUP1 - J
                      DO 50 I = MAX(1,J-KU),MIN(M,J+KL)
                          Y(I) = Y(I) + TEMP*A(K+I,J)
   50                 CONTINUE
                  END IF
                  JX = JX + INCX
   60         CONTINUE
          ELSE
              DO 80 J = 1,N
                  IF (X(JX).NE.ZERO) THEN
                      TEMP = ALPHA*X(JX)
                      IY = KY
                      K = KUP1 - J
                      DO 70 I = MAX(1,J-KU),MIN(M,J+KL)
                          Y(IY) = Y(IY) + TEMP*A(K+I,J)
                          IY = IY + INCY
   70                 CONTINUE
                  END IF
                  JX = JX + INCX
                  IF (J.GT.KU) KY = KY + INCY
   80         CONTINUE
          END IF
      ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Form  y := alpha*A'*x + y  or  y := alpha*conjg( A' )*x + y.
</span><span class="comment">*</span><span class="comment">
</span>          JY = KY
          IF (INCX.EQ.1) THEN
              DO 110 J = 1,N
                  TEMP = ZERO
                  K = KUP1 - J
                  IF (NOCONJ) THEN
                      DO 90 I = MAX(1,J-KU),MIN(M,J+KL)
                          TEMP = TEMP + A(K+I,J)*X(I)
   90                 CONTINUE
                  ELSE
                      DO 100 I = MAX(1,J-KU),MIN(M,J+KL)
                          TEMP = TEMP + CONJG(A(K+I,J))*X(I)
  100                 CONTINUE
                  END IF
                  Y(JY) = Y(JY) + ALPHA*TEMP
                  JY = JY + INCY
  110         CONTINUE
          ELSE
              DO 140 J = 1,N
                  TEMP = ZERO
                  IX = KX
                  K = KUP1 - J
                  IF (NOCONJ) THEN
                      DO 120 I = MAX(1,J-KU),MIN(M,J+KL)
                          TEMP = TEMP + A(K+I,J)*X(IX)
                          IX = IX + INCX
  120                 CONTINUE
                  ELSE
                      DO 130 I = MAX(1,J-KU),MIN(M,J+KL)
                          TEMP = TEMP + CONJG(A(K+I,J))*X(IX)
                          IX = IX + INCX
  130                 CONTINUE
                  END IF
                  Y(JY) = Y(JY) + ALPHA*TEMP
                  JY = JY + INCY
                  IF (J.GT.KU) KX = KX + INCX
  140         CONTINUE
          END IF
      END IF
<span class="comment">*</span><span class="comment">
</span>      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="CGBMV.317"></a><a href="cgbmv.f.html#CGBMV.1">CGBMV</a> .
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>
